package com.hmkj.core.mapper.myChoose;

import com.hmkj.common.baseMapper.GenericMapper;
import com.hmkj.core.model.myChoose.MyChooseModel;
import com.hmkj.core.po.myChoose.MyChoose;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * 我的自选相关Dao接口<br>
 *
 * @author eproo
 * @date   2018-07-09 04:50:59
 */
public interface MyChooseMapper extends GenericMapper<MyChoose,Integer> {


    /**
     * 我的自选列表
     *
     * @param param 参数集合
     * @return List<MyChooseModel>
     */
    @Select(" <script> SELECT t.* " +
            "FROM biz_my_choose t " +
            "WHERE t.user_id = #{userId} AND " +
            "t.del_flag = 1 " +
            "ORDER BY t.is_top desc, t.sort desc</script>")
//    @Select("<script>select t* from biz_my_choose where t.del_flag = 1 and t.user_id = #{userId} " +
//            "and t.code=#{code} ORDER BY t.is_top desc, t.sort desc</script>")
    List<MyChooseModel> findListForChoose(Map<String, Object> param);

    /**
     * 我的自选列表
     *
     * @param param 参数集合
     * @return Integer
     */

//    @Select("<script>select count(*) from biz_my_choose where t.del_flag = 1 and t.user_id = #{userId} " +
//            "and t.code=#{code} ORDER BY t.is_top desc, t.sort desc</script>")
    @Select(" <script> SELECT count(*) " +
            "FROM biz_my_choose t " +
            "WHERE t.user_id = #{userId} " +
            "AND t.del_flag = 1 " +
            "ORDER BY t.is_top desc, t.sort desc</script>")
    Integer findCountForChoose(Map<String, Object> param);
}
